home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
-
- /*
- * main.c contains only the main() function of hrq, a command line wrapper
- * around function host_responds_quickly. hrq is essentially a no-frills
- * version of ping, but one in which the timeout period is mercifully brief.
- * hrq prints an advisory about whether the host whose name is given as the
- * only command line argument responds to an ICMP echo request before a
- * short timer expires. It sets its exit status to 1 if the host does not
- * respond quickly, to 0 if it does respond quickly, and to a negative number
- * if there is some error.
- *
- * Program hrq needs to be installed setuid to root.
- *
- * Author: Aaron Schuman
- */
-
- #include <stdio.h>
- #include "hrq.h"
-
- main( int argc, char * argv[] )
- {
- int response;
- char * errmsg;
-
- if ( 2 != argc )
- {
- fprintf( stderr, "Usage: %s host\n", argv[0] );
- exit( -1 );
- }
-
- response = host_responds_quickly( argv[1] );
-
- if ( 0 > response )
- {
- fprintf( stderr, "%s error \"%s\"; hostname = %s\n",
- "host_responds_quickly", hrqerr( response ), argv[1] );
- exit( response );
- }
-
- printf( "Reply %s received from %s\n",
- QUICK_RESPONSE == response ? "was" : "not", argv[1] );
-
- exit( response );
- }
-
-